package edu.hm.activebadge.rfid.interpretation.tagclass;

import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;

public class Location implements ITaggedEntity {
	
	private GregorianCalendar timestamp;
	private String tag;
	private String locationName;
	
	private ArrayList<Person> persons;
	private ArrayList<Item> objects;

	
	public Location(){};
	
	public Location(String name, String t, GregorianCalendar time){
		locationName = name;
		tag = t;
		timestamp = time;
	}
	
	
	public GregorianCalendar getTimestamp() {
		
		return timestamp;
	}

	public void setTimestamp(GregorianCalendar t) {
		timestamp = t;

	}

	public void setTag(String t) {
		tag = t;

	}

	public String getTag() {
		return tag;
	}

	public String getName() {
		return locationName;
	}

	public void setName(String n) {
		locationName = n;
		
	}

	public List<Person> getPersons() {
		return persons;
	}

	public void setPersons(ArrayList<Person> persons) {
		this.persons = persons;
	}

	public List<Item> getObjects() {
		return objects;
	}

	public void setObjects(ArrayList<Item> objects) {
		this.objects = objects;
	}
	
	public void addPerson(Person p){
		p.setLocation(this);
		persons.add(p);
	}
	
	public void addObject(Item o){
		o.setLocation(this);
		objects.add(o);
	}
	
	public void deletePerson(Person p){
		p.setLocation(null);
		persons.remove(p);
	}
	
	public void deleteObject(Item o){
		o.setLocation(null);
		objects.remove(o);
	}

}
